package org.zhenggn.designpattern.chain;

/**
 * Created by zhenggn on 2017/5/3.
 */
public class GoodsSaleEbo {
    public  boolean sale(String user,String customer,SaleModel saleModel,User u) {
        // 1:权限检查
        // 2:通用数据检查
        // 3:数据逻辑校验
        // 4:真正的业务处理
        SaleSecurityCheck ssc = new SaleSecurityCheck();
        SaleDataCheck sdc = new SaleDataCheck();
        SaleLogicCheck slc = new SaleLogicCheck();
        SaleMgr sd = new SaleMgr();
        ssc.setSuccessor(sdc);
        sdc.setSuccessor(slc);
        slc.setSuccessor(sd);
        // 向链上的第一个对象发出处理的请求
        return ssc.sale(user, customer, saleModel,u);
    }
}
